/**
 * @project_name staff_vehicle
 * @package_name com.ssh.dao
 * @desc TODO
 * @param
 * @author jack
 * @date 2013-4-24
 * @time 下午5:41:27
 */
package com.ssh.dao;

import java.util.List;

import org.hibernate.SessionFactory;

import com.ssh.entity.StaffAflInfo;
import com.ssh.model.MyAFL;

/**
 * @author jack
 *
 */
public class AflInfoDAOImpl implements AflInfoDAOI {
	private SessionFactory sessionFactory;

	/* (non-Javadoc)
	 * @see com.ssh.dao.AflInfoDAOI#queryById(java.lang.String)
	 */
	@Override
	public List<MyAFL> queryById(String id) {
		// TODO Auto-generated method stub
		String hql = "SELECT new MyAFL(a.aflDate,safli.backDate,safli.leaveDate ,a.reviewerId)"+
                         "FROM staff_afl_info AS safli , Card AS c ,Staff AS s ,ask_forleave a"+
                               "WHERE s.card.cardId=safli.card.cardId AND s.staffId=a.staffId;";
		@SuppressWarnings("unchecked")
		List<MyAFL> myAFL=sessionFactory.getCurrentSession().createSQLQuery(hql).list();
		return myAFL;
	}

	/* (non-Javadoc)
	 * @see com.ssh.dao.AflInfoDAOI#updateBySAI(com.ssh.entity.StaffAflInfo)
	 */
	@Override
	public StaffAflInfo updateBySAI(StaffAflInfo staffAflInfo) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.ssh.dao.AflInfoDAOI#deleteById(java.lang.String)
	 */
	@Override
	public int deleteById(String id) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.ssh.dao.AflInfoDAOI#addStaffUC(com.ssh.entity.StaffAflInfo)
	 */
	@Override
	public StaffAflInfo addStaffUC(StaffAflInfo staffAflInfo) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.ssh.dao.AflInfoDAOI#addStaffAfIList(java.util.List)
	 */
	@Override
	public int addStaffAfIList(List<StaffAflInfo> staffAflList) {
		// TODO Auto-generated method stub
		return 0;
	}

	/* (non-Javadoc)
	 * @see com.ssh.dao.AflInfoDAOI#queryByIdList(java.lang.String)
	 */
	@Override
	public List<StaffAflInfo> queryByIdList(String strings) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.ssh.dao.AflInfoDAOI#countById(java.lang.String)
	 */
	@Override
	public int countById(String id) {
		// TODO Auto-generated method stub
		return 0;
	}

	/**
	 * @return the sessionFactory
	 */
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	/**
	 * @param sessionFactory the sessionFactory to set
	 */
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

}
